package com.platform.modules.mall.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.platform.common.utils.RestResponse;
import com.platform.modules.mall.service.MallAccessStatisticsService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("mall/accessStatistics")
public class MallAccessStatisticsController {

    @Resource
    private MallAccessStatisticsService mallAccessStatisticsService;

    //页面访问统计
    @GetMapping("/pageStatistics")
    public RestResponse pageStatistics(@RequestParam Map<String, Object> params) {
        return RestResponse.success().put("data", mallAccessStatisticsService.pageStatistics(params));
    }

    //商品访问统计
    @GetMapping("/goodsAccessStatistics")
    public RestResponse goodsAccessStatistics(@RequestParam Map<String, Object> params) {
        return RestResponse.success().put("data", mallAccessStatisticsService.goodsAccessStatistics(params));
    }

    //商品购买统计
    @GetMapping("/goodsBuyStatistics")
    public RestResponse goodsBuyStatistics(@RequestParam Map<String, Object> params) {
        return RestResponse.success().put("data", mallAccessStatisticsService.goodsBuyStatistics(params));
    }

    //商品退款统计
    @GetMapping("/goodsRefundStatistics")
    public RestResponse goodsRefundStatistics(@RequestParam Map<String, Object> params) {
        return RestResponse.success().put("data", mallAccessStatisticsService.goodsRefundStatistics(params));
    }

    //用户总数统计
    @GetMapping("/userTotalStatistics")
    public RestResponse userTotalStatistics() {
        return RestResponse.success().put("data", mallAccessStatisticsService.userTotalStatistics());
    }

    //用户新增统计
    @GetMapping("/userAddStatistics")
    public RestResponse userAddStatistics(@RequestParam Map<String, Object> params) {
        return RestResponse.success().put("data", mallAccessStatisticsService.userAddStatistics(params));
    }

    //用户活跃统计
    @GetMapping("/userActiveStatistics")
    public RestResponse userActiveStatistics() {
        return RestResponse.success().put("data", mallAccessStatisticsService.userActiveStatistics());
    }

}
